package com.app.xinfadi.ui.purchase_plan.view;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * function:
 * Created by Wutengfei on 2016/1/25.
 */
public class PurchasePlanPagerAdapter extends FragmentPagerAdapter {
    private final String[] TITLES = {"报价转增计划", "中心新增计划"};
    private ArrayList<Fragment> purchasePlanFragmentList;

    public PurchasePlanPagerAdapter(FragmentManager fm, ArrayList<Fragment> purchasePlanFragmentList) {
        super(fm);
        this.purchasePlanFragmentList = purchasePlanFragmentList;
    }


    @Override
    public int getCount() {
        return purchasePlanFragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }


    @Override
    public Fragment getItem(int position) {
        return purchasePlanFragmentList.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }

}
